<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');

    class Special_case_m extends CI_Model {
        public function __construct() {
            
        }
        
        function check_which_to_edit($name) {
            $replace_name =  str_replace("_"," ", $name); 
            $this->db->where('category_name', $replace_name);
            $cat = $this->db->get('category');
            $categoty = $cat->num_rows();
            
            $this->db->where('rolename', $replace_name);
            $rol = $this->db->get('role');
            $role = $rol->num_rows();
            
            $this->db->where('dept_name', $replace_name);
            $dep = $this->db->get('dept');
            $dept = $dep->num_rows();
            
            $this->db->where('course_name', $replace_name);
            $cor = $this->db->get('course');
            $course = $cor->num_rows();
            
            if($categoty > 0){
                return 'category';
            }else if($role > 0) {
                return 'role';
            }else if($dept > 0) {
                return 'department';
            }else if($course > 0) {
                return 'course';
            }
        }
    }
?>